
angular.module('mamApp').controller('modifyPasswordController', ['$scope', 'SystemManager', '$state','ImsAlert','ImsErr',
    function ($scope, SystemManager, $state,ImsAlert,ImsErr) {
        $scope.user={};
        $scope.confirm = function () {

            if($scope.user.newpwd==$scope.user.repwd){
                SystemManager.resetPassword({newpwd:$scope.user.newpwd,oldpwd:$scope.user.oldpwd}).then(function (result) {
                    if(result.data.c=="s"){
                        ImsAlert.open({message:"密码修改成功"}).then(function (a) {
                            $state.go("main.home")
                        })
                    }else {
                        ImsErr.open({message:result.data.i}).then(function (a) {
                        })
                    }
                })
            }
        }


    }])
